# frozen_string_literal: true

# Here is the 'helloworld' action

post '/login' do
  'admin_add'
end

get '/get_info' do
  admin = {
    name: 'admin',
    user_id: '2',
    access: ['admin'],
    token: 'admin',
    avatar: 'https://file.iviewui.com/dist/a0e88e83800f138b94d2414621bd9704.png'
  }
  admin.to_json
end

post '/save_error_logger' do
  puts params
end

get '/get_table_data' do
  data = [{
    name: 'admin',
    mobile: '13590296150',
    createTime: '2019-09-22 11:30:20'
  }, {
    name: 'dominic',
    mobile: '13788889762',
    createTime: '2019-09-22 11:30:20'
  }, {
    name: 'admin',
    mobile: '13590296150',
    createTime: '2019-09-22 11:30:20'
  }, {
    name: 'admin',
    mobile: '13590296150',
    createTime: '2019-09-22 11:30:20'
  }]
  data.to_json
end

get '/members' do
  ap @json_params
  # return Member.page(2) if @json_params[:page]

  Member.all.to_json
end
